IRIX example source

"irix-related" programs, scripts, etc.
This subtree contains IRIX example source implementations geared to
assist those endeavoring to enhance their understanding of the
evermore-complex world of systems programming, and script
hackery-extraordinaire.
The following implementations are included herein:
- context -- getting and setting user context within a process
- fileLocking -- local and remote file locking programs
- gmemusage -- a graphical memory usage display tool
- load_avg -- obtain the current system load average
- playEngine -- sproc/semaphore source
- scripts -- various c-shell scripts
- sockets -- introduction to sockets with a client and a server program
- uucpVadmin -- UUCP visual administration tool
- tools -- unix/system-level programs
Be sure to also check out the toolbox/documents/cc_c++_make_csh subtree
for an assemblage of documents relating to compilers, make, and [c]shell,
as well as the toolbox/documents/ {irix, irix5.2, irix5.3, irix6.2} subtrees for
documentation relating to general and release-specific information on IRIX.
- context -- getting and setting user context within a process
provides an example of using the getcontext(2), setcontext(2)
and makecontext(3C) functions introduced in IRIX 5.x. These functions
are useful for implementing user level context switching between
multiple threads of control within a single IRIX process.
This program originate from the Pipeline article, "Getting and Setting
User Context Within a Process," which lives in the toolbox/documents/irix directory.
- fileLocking -- local and remote file locking programs
Programmers that write large multi-user applications which access
databases are commonly faced with the question of data locking and
integrity. These programs demonstrate data locking on local and
remote systems.
These programs originate from the Pipeline article,
"Local and Remote File
Locking," which lives in the toolbox/documents/irix directory.
- gmemusage -- a graphical memory usage display tool
This program was developed at Silicon Graphics to help programmers
analyze how their programs, and the system as a whole, is using memory.
gmemusage displays a bar chart depicting the breakdown of memory use,
with each bar labeled with the name of the program using the
memory and the number of kilobytes of memory used.
In addition, gmemusage will display a breakdown of the
regions within a program. Clicking on a bar or program name
in the main chart will replace the main chart with a chart
for that program, with each region labeled with one of Text,
Data, Break, Stack, Shmem, Physical Device, RW, RO, and (if
possible) the base name of the file or device corresponding
to each region. If gmemusage is unable to determine the
base name of the file or device for a region that does
correspond to a file or device, gmemusage will display the
inode number of the file or device.
- load_avg -- obtain the current system load average
A developer of an application may want to know how busy the processor is
prior to launching a process; it might choose to allocate the process to
another machine or it might choose to defer the launch to a later time.
Although the kernel keeps track of load average, it provides no interface
to programmers who wish to see that information. There is a powerful
tool available for situations where there is no interface to a piece of
kernel data; the program may read kernel memory directly. This power
is accompanied by a certain risk: programs that read kernel memory are
unlikely to be portable from one Unix system to another, and they may not
even be portable on the same system from one release to another.
The example in this directory may be used as a model of how to browse
kernel memory for a useful data element, or the example may be used
without modification in your application.
- playEngine -- sproc/semaphore source
Employing sproc and semaphore, playEngine implements raising a
sub-process's priority so as to be able to circumvent
preemption. playEngine provides a set of routines permitting
an audio track to be played without interference from operating
system multitasking activities. sproc (similar to fork) is
employed to raise the forked sub-process priority high enough so
the other operating system activities cannot preempt it. The
main application provides this new process with a pointer to
the data to be played and starts and stops the process through
signals and/or semaphores.
- scripts -- various c-shell scripts
The C-shell scripts, created/used by colleagues possibly
useful to others, if for no other purpose than as examples
of shell programming source:
- 11 general-purpose c-shell scripts
- 11 rcs-specific c-shell scripts
- sockets -- introduction to sockets with a client and a server program
Sockets are an application programming interface (API) for network
applications in a UNIX environment. Sockets are a UNIX interface to
the TCP/IP protocol and were developed at the University of
California at Berkeley.
The example discussed in this article uses a connection-oriented (TCP)
client/server model. The programs establish a connection between two
systems (or two processes on the same system), and data is passed
from the client to the server. The programs are designed to be very
simple and straightforward.
These programs originate from the Pipeline article, "Getting Started
With Socket Programming," which lives in the toolbox/documents/irix directory.
- uucpVadmin -- UUCP visual administration tool
This tool allows the user to set up the UUCP files using a
Graphical User Interface and make sure communication to a modem
is good. uucpVadmin contains inst images as well as src for
the UUCP vadmin tool.
- tools -- unix/system-level programs
- Lastrev:
collects info about revisions and symbols defined
in RCS files and then prints this information.
- chktime:
compares 2 files modification times and returns -1,
or +1 depending on whether the first file was
modified before, at the same time, or after the
second file.
- getopt:
enhanced version of the unix system call.
- gettime:
gets last modification time of file and writes it
to stdout.
- gpasswd:
identical to passwd except this sets the password
for a group in the /etc/group file.
- isIn:
returns true/false if first parameter is equal to
any of the other parameters on the command line.
- listWMres:
lists all resources known to the window manager.
- printf:
better than the one provided in IRIX 5 because it
can handle all the standard C types.
- rcstime:
returns the time of the last RCS update in an RCS
file.
- strlen:
shell-equivalent of strlen(3C) returns the length of
the string provided on the command line.
- unique:
returns all parameters passed on the command line
removing any duplicates.
- vacupd:
reads and modifies data in the vacation database
files.
Files of interest from "src/exampleCode/irix" directory
Documentation
Reference
OR, ...
Copyright © 1995, Silicon Graphics, Inc.